package org.skyeye.modeling.view;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.part.ViewPart;
import org.skyeye.modeling.TestData;
import org.skyeye.modeling.api.FaultAPI;
import org.skyeye.modeling.constants.RPCConstants;
import org.skyeye.modeling.model.DevBean;
import org.skyeye.modeling.model.MachBean;
import org.skyeye.modeling.model.RegBean;
import org.skyeye.modeling.provider.DeviceTreeContentProvider;
import org.skyeye.modeling.provider.DeviceTreeLabelProvider;
import org.skyeye.modeling.ui.CustButton;
import org.skyeye.modeling.util.ColorUtil;
import org.skyeye.modeling.util.LayoutUtils;

import com.alibaba.fastjson.JSONObject;

/**
 * 故障注入视图
 * @author Louis
 */
public class FaultInjectionView extends ViewPart {

	public static final String ID = FaultInjectionView.class.getName();
	private Composite container;
	private TreeViewer treeViewer;
	private String KONGGE = "     ";
	
		/** 表格 */
	private TableViewer injectBitTableViewer;
	
	private TableViewer falutListTableViewer;
	
	private StackLayout stackLayout;
	private Composite compositeIO;
	private Composite compositeMemo;
	
	private Object selectObj;

	public FaultInjectionView() {
	}
	
	@Override
	public void createPartControl(Composite parent) {
		container = new Composite(parent, SWT.BORDER);
		container.setLayoutData(new GridData(GridData.FILL_BOTH));
		container.setLayout(new GridLayout(1, false));
		GridData gridData;
		SashForm parentCom = new SashForm(container, SWT.HORIZONTAL);

		GridLayout layout = new GridLayout(1,false);
		LayoutUtils.setMarginEquals0(layout);
		parentCom.setLayoutData(new GridData(GridData.FILL_BOTH));
		parentCom.setLayout(layout);
		
		Group devTree = new Group(parentCom, SWT.NONE);
		layout = new GridLayout();
		LayoutUtils.setMarginEquals0(layout);
		devTree.setLayout(layout);
		gridData = new GridData(GridData.FILL_BOTH);
		devTree.setLayoutData(gridData);
		devTree.setText("设备列表");

		
		createLeftDeviceTree(devTree);
		createRightContent(parentCom);
		
		parentCom.setWeights(new int[] {2,5});
	}
	
	private void createLeftDeviceTree(Composite parent) {
		createTreeArea(parent);
		refreshInput();
	}
	
	private void createRightContent(Composite parent) {
		
		SashForm comRight = new SashForm(parent, SWT.VERTICAL);
		comRight.setLayoutData(new GridData(GridData.FILL_BOTH));
		GridLayout layout = new GridLayout(1, false);
		LayoutUtils.setMarginEquals0(layout);
		comRight.setLayout(layout);
		
		Group upperGroup = new Group(comRight,SWT.NONE);
		layout = new GridLayout(1,false);
		LayoutUtils.setMarginEquals0(layout);
		upperGroup.setLayout(layout);
		GridData gridData = new GridData(GridData.FILL_BOTH);
		upperGroup.setLayoutData(gridData);
		upperGroup.setText("故障注入");
		
		createModelBtnContent(upperGroup);
		createInjectBitContent(upperGroup);
		
		createFaultListContent(comRight);
		
		comRight.setWeights(new int[] {3,2});
		
		
	}

	private void createModelBtnContent(Group upperGroup) {
		GridLayout layout;
		Group modelGroup = new Group(upperGroup,SWT.NONE);
		layout = new GridLayout(40,true);
		LayoutUtils.setMarginEquals0(layout);
		modelGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		modelGroup.setLayout(layout);
		modelGroup.setText("模式");
		
		printBlankLine(modelGroup);
		Label ll= new Label(modelGroup,SWT.WRAP);
		ll.setText(KONGGE);
		ll.setBackground(ColorUtil.red);
		new Label(modelGroup,SWT.NONE|SWT.WRAP).setText("置0");
		printBlankLine(modelGroup);
		Label l2= new Label(modelGroup,SWT.WRAP);
		l2.setText(KONGGE);
		l2.setBackground(ColorUtil.blue);
		
		new Label(modelGroup,SWT.WRAP).setText("置1");
		printBlankLine(modelGroup);		
		Label l3= new Label(modelGroup,SWT.WRAP);
		l3.setText(KONGGE);
		l3.setBackground(ColorUtil.yellow);
		
		new Label(modelGroup,SWT.WRAP).setText("取反");
		printBlankLine(modelGroup);
		Label l4= new Label(modelGroup,SWT.WRAP);
		l4.setText(KONGGE);
		l4.setBackground(ColorUtil.white);
		Label donone = new Label(modelGroup,SWT.NONE|SWT.WRAP);
		donone.setText("no action");
		printBlankLine(modelGroup);
	}
	
	private void printBlankLine(Composite modelGroup) {
		new Label(modelGroup,SWT.NONE|SWT.WRAP);
	}

	private void createFaultListContent(SashForm comRight) {
		GridLayout layout;
		GridData gridData;
		Group belowGroup = new Group(comRight,SWT.NONE);
		layout = new GridLayout();
		LayoutUtils.setMarginEquals0(layout);
		belowGroup.setLayout(layout);
		gridData = new GridData(GridData.FILL_BOTH);
		belowGroup.setLayoutData(gridData);
		belowGroup.setText("");
		
		createFalutListTableArea(belowGroup);
		
	}
	
	private void createInjectBitContent(Group upperGroup) {
		Group bitGroup = new Group(upperGroup,SWT.NONE);
		GridLayout layout = new GridLayout(1,false);
		LayoutUtils.setMarginEquals0(layout);
		bitGroup.setLayout(layout);
		bitGroup.setText("inject position");
		bitGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
		
		drawInjectBitBtns(bitGroup);
		
		Composite comp = new Composite(upperGroup,SWT.NONE);
		layout = new GridLayout(4,false);
		LayoutUtils.setMarginEquals0(layout);
		comp.setLayout(layout);
		comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
		
		Button injectActionBtn = new Button(comp,SWT.BORDER); 
		GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
		layoutData.horizontalSpan = 3;
		injectActionBtn.setLayoutData(layoutData);
		injectActionBtn.setText("注入故障");
		
		new Label(comp,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		
	}

	
	/**
	 * 绘制注入位
	 * @param bitGroup
	 */
	private void drawInjectBitBtns(Group bitGroup) {
		
		Composite compositeStackLayout = new Composite(bitGroup, SWT.NONE);
		stackLayout = new StackLayout();
		compositeStackLayout.setLayout(stackLayout);
		compositeStackLayout.setLayoutData(new GridData(GridData.FILL_BOTH));
		
		//--------------IO设备注入位信息 stackLayout层
		compositeIO = new Composite(compositeStackLayout, SWT.NONE);
		GridLayout layout = new GridLayout(1, false);
		LayoutUtils.setMarginEquals0(layout);
		compositeIO.setLayout(layout);
		compositeIO.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		
		createIOInjectBit(compositeIO);
		
		//-------------寄存器设备注入信息 stackLayout层
		compositeMemo = new Composite(compositeStackLayout, SWT.NONE);
		layout = new GridLayout(1, false);
		LayoutUtils.setMarginEquals0(layout);
		compositeMemo.setLayout(layout);
		compositeMemo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		
		createMemoInjectBit(compositeMemo);

	}
	
	/**
	 * 内存设备
	 * @param compositeMemo2
	 */
	private void createMemoInjectBit(Composite compositeMemo2) {
		new Label(compositeMemo2,SWT.NONE).setText("label 2");
		stackLayout.topControl = compositeMemo2;
	}

	private Map<String,Widget> map = new HashMap<String,Widget>(); 
	
	/**
	 * IO设备
	 * @param compositeIO2
	 */
	private void createIOInjectBit(Composite compositeIO2) {
		Composite composite = new Composite(compositeIO2, SWT.NONE);
		GridLayout layout = new GridLayout(21, true);
		LayoutUtils.setMarginEquals0(layout);
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		// 绘制表头
		new Label(composite, SWT.NONE).setLayoutData(new GridData(
				GridData.FILL_HORIZONTAL));
		for (int i = 0; i <= 7; i++) {
			Label label = new Label(composite, SWT.CENTER);
			label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
					| GridData.CENTER));
			label.setText("  " + i + "");
		}
		printSpace(composite);

		int start = 0;
		int end = 7;
		for (int i = start; i <= end; i++) {
			for (int j = 8 * i; j <= (i + 1) * 8; j++) {
				if (j == 8 * i) {
					Label label = new Label(composite, SWT.NONE | SWT.CENTER);
					label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
					label.setText(8 * i + " - " + (8 * (i + 1) - 1));
					map.put("label" + i + "", label);
				} else {
					CustButton custButton = new CustButton(composite,
							SWT.CENTER);
					custButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

					map.put("btn" + j + "", custButton);
				}
			}
			printSpace(composite);
		}
		GridData g = new GridData(GridData.FILL_HORIZONTAL);
		g.horizontalSpan = 15;
		new Label(composite, SWT.NONE).setLayoutData(g);

	}

	private void printSpace(Composite composite) {
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		new Label(composite,SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	}

	protected void refreshInput() {
		String test = TestData.test("deviceInfo.json");
//		JSONObject jsonObject = JSONObject.parseObject(test);
		JSONObject faultInjectDeviceInfo = FaultAPI.getFaultInjectDeviceInfo();
		treeViewer.setInput(getFalutDevBeanInput(faultInjectDeviceInfo));
		treeViewer.refresh();

	}
	
	private List<MachBean> getFalutDevBeanInput(JSONObject jsonObject) {
		List<MachBean> machs = new ArrayList<MachBean>();
		Set<Entry<String, Object>> entrySet = jsonObject.entrySet();
		MachBean machBean = null;
		for(Entry entry : entrySet) {
			machBean = new MachBean();
			machBean.setMachname(entry.getKey().toString());
			if(entry.getValue() instanceof JSONObject) {
				List<DevBean> devList = new ArrayList<DevBean>();
				assemblyDev(machBean, entry, devList);
				machBean.addAllDevBeans(devList);
				machs.add(machBean);	
			}
		}

		return machs;
	}

	/**
	 * 拼装设备信息
	 * @param machBean
	 * @param entry
	 * @param devList
	 */
	private void assemblyDev(MachBean machBean, Entry entry,
			List<DevBean> devList) {
		DevBean devBean = null;
		JSONObject subObj = (JSONObject) entry.getValue();
		Set<Entry<String, Object>> devEntSet = subObj.entrySet();
		for(Entry devSet : devEntSet) {
			devBean = new DevBean();
			devBean.setDevname(devSet.getKey().toString());
			devBean.setParent(machBean);
			JSONObject deviceRegisterInfo = FaultAPI.getDeviceRegisterInfo(machBean.getMachname(), devBean.getDevname());
//			JSONObject regJson = JSONObject.parseObject(TestData.test("reg_info.json"));// 用API替换
			List<RegBean> regBeans = assemblyReg(devBean, deviceRegisterInfo);
			devBean.addAllRegBeans(regBeans);
			devList.add(devBean);
		}
	}

	/**
	 * 拼装寄存器列表信息
	 * @param devBean
	 * @param regJson
	 * @return
	 */
	private List<RegBean> assemblyReg(DevBean devBean, JSONObject regJson) {
		Set<Entry<String, Object>> regEnSet = regJson.entrySet();
		List<RegBean> regBeans = new ArrayList<RegBean>();
		RegBean regBean = null;
		for(Entry regEn: regEnSet) {
			 regBean = new RegBean();
			 regBean.setRegname(regEn.getKey().toString());
			 regBean.setParent(devBean);
			 JSONObject regDetail = (JSONObject)  regEn.getValue();
			 for(Entry regDe:regDetail.entrySet() ) {
				 if(regDe.getKey().equals(RPCConstants.ATTRIBUTE_WIDTH)) {
					 regBean.setWidth(regDe.getValue().toString());
				 } else if(regDe.getKey().equals(RPCConstants.ATTRIBUTE_OFFSET)) {
					 regBean.setOffset(regDe.getValue().toString());

				 } else if(regDe.getKey().equals(RPCConstants.ATTRIBUTE_VALUE)) {
					 regBean.setValue(regDe.getValue().toString());
				 } else if(regDe.getKey().equals(RPCConstants.ATTRIBUTE_ADDR)) {
					 regBean.setAddr(regDe.getValue().toString());
				 }
			 }
			 regBeans.add(regBean);
		}
		return regBeans;
	}
	
	private void createTreeArea(Composite group) {
		treeViewer = new TreeViewer(group, SWT.BORDER);
		Tree tree = treeViewer.getTree();
		tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		tree.setBackground(ColorUtil.getColor(255, 255, 255));
		treeViewer.setContentProvider(new DeviceTreeContentProvider());
		treeViewer.setLabelProvider(new DeviceTreeLabelProvider());
		treeViewer.expandToLevel(1);
		treeViewer.addFilter(new ViewerFilter() {
			
			@Override
			public boolean select(Viewer viewer, Object parentElement,
					Object element) {
				return true;
			}
		});
		treeViewer.addSelectionChangedListener(treeViewerSelect);

	}
	
	// 树选中事件
	ISelectionChangedListener treeViewerSelect = new ISelectionChangedListener() {
		@Override
		public void selectionChanged(SelectionChangedEvent event) {
			Object source = event.getSource();
			IStructuredSelection select = (IStructuredSelection) event
					.getSelection();
			if (source == treeViewer) {
				selectObj = select.getFirstElement();
				if (selectObj instanceof DevBean) {
					DevBean devbean = (DevBean) select.getFirstElement();
					showIOInterfaceVisible(false);
					
				} else if (selectObj instanceof RegBean) {
					showIOInterfaceVisible(true);
					RegBean regBean = (RegBean) selectObj;
					String width = regBean.getWidth();
					int parseInt = Integer.parseInt(width);
					int start = parseInt;
					int end = 7;
					changeBtnVisible(start, end);
					
					String binaryString = Long.toBinaryString(Long.parseLong(regBean.getAddr()));
//					for(int i=1;i<=8*parseInt;i++) {
					for(int i=0;i<binaryString.length();i++) {
						((CustButton)map.get("btn"+(i+1))).setText(binaryString.charAt(i) +"");
					}
					
					if(binaryString.length() < 8*parseInt) {
						for(int j=binaryString.length()+1;j<=8*parseInt;j++) {
							((CustButton)map.get("btn"+(j))).setText(0 +"");
						}
					}
						System.out.println("");
//					}
//					RegBean devbean = (RegBean) select.getFirstElement();
				}
			}
		}

		/**
		 * 设置注入按钮的可编辑状态
		 * @param start
		 * @param end
		 */
		private void changeBtnVisible(int start, int end) {
			for (int i = 0; i < start; i++) {
				// 设置前面需要显示的部分
				for (int j = 8 * i; j <= (i + 1) * 8; j++) {
					if (j == 8 * i) {
						Label label = (Label)map.get("label"+i);
						label.setVisible(true);
					} else {
						CustButton custButton = (CustButton)map.get("btn"+j+"");
						custButton.setVisible(true);
//						custButton.setData("3");
//						custButton.setImage(ImageProviderMapper.getImage(ImageInfo.WHITE));
					}
				}
			}
			
			for (int i = start; i <= end; i++) {
				//设置不需要显示的部分
				for (int j = 8 * i; j <= (i + 1) * 8; j++) {
					if (j == 8 * i) {
						Label label = (Label)map.get("label"+i);
						label.setVisible(false);
					} else {
						CustButton custButton = (CustButton)map.get("btn"+j+"");
						custButton.setVisible(false);
					}
				}
			}
		}

	};
	
	private void showIOInterfaceVisible(boolean flag) {
		if (flag) {
			stackLayout.topControl = compositeIO;
			compositeIO.getParent().layout();
		} else {
			stackLayout.topControl = compositeMemo;
			compositeIO.getParent().layout();
		}
	}
	
	
//	public Map<String,Object> map = new HashMap<String,Object>();
	
	
	private void createInjectBitTableArea(Composite group) {

		injectBitTableViewer = new TableViewer(group,SWT.NONE);
		Table table = injectBitTableViewer.getTable();
		table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		table.setBackground(ColorUtil.getColor(255, 255, 255));
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		createTableViewerColumn(injectBitTableViewer, "", 150, 0);
		createTableViewerColumn(injectBitTableViewer, "0", 50, 1);
		createTableViewerColumn(injectBitTableViewer, "1", 50, 2);
		createTableViewerColumn(injectBitTableViewer, "2", 50, 3);
		createTableViewerColumn(injectBitTableViewer, "3", 50, 4);
		createTableViewerColumn(injectBitTableViewer, "4", 50, 5);
		createTableViewerColumn(injectBitTableViewer, "5", 50, 6);
		createTableViewerColumn(injectBitTableViewer, "6", 50, 7);
		createTableViewerColumn(injectBitTableViewer, "7", 50, 8);
		injectBitTableViewer.setContentProvider(new TableContentProvider());
		injectBitTableViewer.setLabelProvider(new TableLabelProvider());
//		tableViewer.addFilter(viewerFilter);
		injectBitTableViewer.addDoubleClickListener(new IDoubleClickListener() {
			@Override
			public void doubleClick(DoubleClickEvent event) {
			}
		});

//		createTableViewerCell(tableViewer);
	}
	
	private void createFalutListTableArea(Composite group) {

		falutListTableViewer = new TableViewer(group,SWT.NONE);
		Table table = falutListTableViewer.getTable();
		table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		table.setBackground(ColorUtil.getColor(255, 255, 255));
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		createTableViewerColumn(falutListTableViewer, "", 150, 0);
		createTableViewerColumn(falutListTableViewer, "", 100, 1);
		createTableViewerColumn(falutListTableViewer, "", 100, 2);
		createTableViewerColumn(falutListTableViewer, "", 100, 3);
		createTableViewerColumn(falutListTableViewer, "", 100, 4);
//		createTableViewerColumn(falutListTableViewer, "4", 50, 5);
//		createTableViewerColumn(falutListTableViewer, "5", 50, 6);  
//		createTableViewerColumn(falutListTableViewer, "6", 50, 7);
//		createTableViewerColumn(falutListTableViewer, "7", 50, 8);
		falutListTableViewer.setContentProvider(new TableContentProvider());
		falutListTableViewer.setLabelProvider(new TableLabelProvider());
//		tableViewer.addFilter(viewerFilter);
		falutListTableViewer.addDoubleClickListener(new IDoubleClickListener() {
			@Override
			public void doubleClick(DoubleClickEvent event) {
			}
		});

//		createTableViewerCell(tableViewer);
	}
	
	
	
    
	private void refreshTableInput(boolean flag) {
		List<DevBean> faultList = new ArrayList<DevBean>();
		DevBean falut = null;
		int num = 4;
		if(flag) {
			num = 1;
		}
		injectBitTableViewer.setInput(faultList);
		injectBitTableViewer.refresh();
		
		TableItem[] items = injectBitTableViewer.getTable().getItems();
		for (int rowid=0; rowid<items.length; rowid++){
		    if (rowid%2==0) items[rowid].setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
		    else items[rowid].setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
		}
	}
	
//	private void createTableViewerCell(TableViewer viewer) {
//		Table table = viewer.getTable();
//		CellEditor[] editors = new CellEditor[table.getColumnCount()];
//		ComboBoxCellEditor comboBoxCellEditor = new ComboBoxCellEditor(table, UimConstants.selectComponent, SWT.READ_ONLY);
//		editors[2] = comboBoxCellEditor;
//		viewer.setCellEditors(editors);
//		viewer.setColumnProperties(column);
//		viewer.setCellModifier(new TableCellModifier(viewer));
//	}
	

	private TableViewerColumn createTableViewerColumn(TableViewer tv, String title, int bound, final int colNumber) {
		final TableViewerColumn viewerColumn = new TableViewerColumn(tv, SWT.NONE, colNumber);
		final TableColumn column = viewerColumn.getColumn();
		column.setText(title);
		column.setWidth(bound);
		column.setResizable(true);
		column.setMoveable(true);
		return viewerColumn;
	}

	
	private class TableLabelProvider implements ITableLabelProvider {

		@Override
		public void addListener(ILabelProviderListener arg0) {

		}

		@Override
		public void dispose() {

		}

		@Override
		public boolean isLabelProperty(Object arg0, String arg1) {
			return false;
		}

		@Override
		public void removeListener(ILabelProviderListener arg0) {

		}

		@Override
		public Image getColumnImage(Object arg0, int arg1) {
			return null;
		}

		@Override
		public String getColumnText(Object arg0, int arg1) {
			DevBean form = (DevBean) arg0;
			return null;
		}

	}

	
	private class TableContentProvider implements IStructuredContentProvider {

		@Override
		public void dispose() {

		}

		@Override
		public void inputChanged(Viewer arg0, Object arg1, Object arg2) {

		}

		@Override
		public Object[] getElements(Object arg0) {
			if (arg0 instanceof List) {
				return ((List<?>) arg0).toArray();
			}
			return new Object[0];
		}

	}

	@Override
	public void setFocus() {
		container.setFocus();
	}
}
